package com.tang.portal.controller.admin.sys;

import com.tang.common.properties.sys.CoolTeaProperties;
import com.tang.framework.core.controller.BaseController;
import com.tang.framework.core.domain.HttpResult;
import com.tang.portal.facade.admin.sys.SysConfigFacade;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.web.bind.annotation.*;

import jakarta.annotation.Resource;

/**
 * @author tang jun liang
 * @Date 2023/6/15 10:43
 */
@Tag(name = "系统配置")
@RequestMapping("/sys/config")
@RestController
public class SysConfigController extends BaseController {

    @Resource
    private SysConfigFacade sysConfigFacade;


    @Schema(description = "获取系统配置信息")
    @GetMapping()
    public HttpResult<CoolTeaProperties> config(){
        return sysConfigFacade.configInfo();
    }


    @Operation(summary = "修改系统配置")
    @PostMapping()
    public HttpResult<String> config(@RequestBody CoolTeaProperties coolTeaProperties){
        return sysConfigFacade.configUpdate(coolTeaProperties);
    }
}
